package rpc.config;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @ClassName: RpcServiceConfig
 * @Description:
 * @author: Kowk
 * @since:1.0.0
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
@Builder
public class RpcServiceConfig {
    //服务版本
    private String version = "";
    //如果一个接口有多个实现类，使用group来分组
    private String group = "";
    //目标服务端
    private Object service;

    public String getServiceName(){
        //获取接口的规范名称
        return this.service.getClass().getInterfaces()[0].getCanonicalName();
    }

    public String getRpcServiceName(){
        return this.getServiceName() + this.getGroup() + this.getVersion();
    }
}
